<template>
	<div>
		<topswiper :tops='tops'></topswiper>
		<card v-for="(book,index) in books" :key="book.id" :book="book"
		name="card"></card>	
		<p class='text-footer'>--------------- 我也是有底线的 --------------</p>
	</div>
</template>
<script>
	import {get} from '@/utils/wechat'
	import wx from '@/utils/wx'
	import Card from '@/components/card'
	import topswiper from '@/components/TopSwiper'

	export default {
		data(){
			return {
				books:[],
				more:true,
				tops:[]
			}
		},
		methods: {
			async getList(){
				//wx.showNavigationBarLoading()
				const books = await get('/weapp/booklist')
				this.books = books.data.data.list
				wx.stopPullDownRefresh()
				//wx.hideNavgationBarLoading()
			},
			async getTop(){
				const tops = await get('/weapp/top')
				this.tops = tops.data.data.list
			}
		},
		onPullDownRefresh(){
			this.getList(true)
			this.getTop()
		},
		mounted(){
			this.getList(true)
			this.getTop()
		},
		components:{
			Card,
			topswiper
		}
	}
</script>
<style>
	

</style>